﻿#pragma once
#include <functional>
#include <map>
#include <signal.h>

namespace as
{
    namespace tools
    {
        class Signal
        {
        public:
            Signal() = default;
            ~Signal() = default;

#ifdef _WIN32
            static bool __stdcall signal_handler(int signal);
#else
            static void signal_handler(int signal);
#endif

            static void register_signal(int signum, std::function<void()> &&func);

            static std::map<int, std::function<void()> > handlers;
        };
    }

}
